package jupitermouse.site.example.scala.window

import java.util.Properties

import org.apache.flink.api.common.serialization.SimpleStringSchema
import org.apache.flink.streaming.api.scala.StreamExecutionEnvironment
import org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer

object KafkaConnectorConsumerApp {

  def main(args: Array[String]): Unit = {
    val env = StreamExecutionEnvironment.getExecutionEnvironment

    import org.apache.flink.api.scala._

    val properties = new Properties()
    properties.setProperty("bootstrap.servers", "192.168.81.130:9092")
    // only required for Kafka 0.8
    properties.setProperty("zookeeper.connect", "192.168.81.130:2181")
    properties.setProperty("group.id", "test")
    val stream = env
      .addSource(new FlinkKafkaConsumer[String]("flink", new SimpleStringSchema(), properties))

    stream.print()


    env.execute("KafkaConnectorConsumerApp")
  }
}
